﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/Layouts/Admin.Master" AutoEventWireup="true"
    CodeBehind="ProductDescription.aspx.cs" Inherits="MLM.AdminCP.Pages.ProductDescription" culture="auto" meta:resourcekey="PageResource1" uiculture="auto" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Label ID="lbProductBaseID" runat="server" 
        Text="Product Description Management" 
        meta:resourcekey="lbProductBaseIDResource1"></asp:Label>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function RowDblClick(sender, eventArgs) {
                sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
            
        </script>
        <script type="text/javascript">
            var popUp;
            function PopUpShowing(sender, eventArgs) {
                popUp = eventArgs.get_popUp();
                var gridWidth = sender.get_element().offsetWidth;
                var gridHeight = sender.get_element().offsetHeight;
                var popUpWidth = popUp.style.width.substr(0, popUp.style.width.indexOf("px"));
                var popUpHeight = popUp.style.height.substr(0, popUp.style.height.indexOf("px"));
                popUp.style.left = (($(window).width() - popUpWidth) / 2) + "px";
                popUp.style.top = "100px";
            } 
        </script>
    </telerik:RadCodeBlock>
    <telerik:RadGrid ID="RadProductDescriptionGrid" runat="server" AllowFilteringByColumn="True"
        DataSourceID="GroupProductDescriptionEds" AllowPaging="True" AllowSorting="True"
        GridLines="None" ShowGroupPanel="True"  AllowAutomaticInserts="True"
        AllowAutomaticUpdates="True" AllowAutomaticDeletes="True" 
        ShowFooter="True" ShowStatusBar="True" 
        meta:resourcekey="RadProductDescriptionGridResource1">
        <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True">
            <Selecting AllowRowSelect="True" />
            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
        </ClientSettings>
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="ProductDescriptionID"
            DataSourceID="GroupProductDescriptionEds" ShowHeader="true" ShowHeadersWhenNoRecords="true"
            AllowAutomaticInserts="true" CommandItemDisplay="TopAndBottom" EditMode="PopUp">
            <%--<MasterTableView ShowFooter="false" DataKeyNames="ProductID" EditMode="InPlace" CommandItemDisplay="TopAndBottom">--%>
            <CommandItemSettings ShowAddNewRecordButton="true" ShowRefreshButton="true">
                <%--ExportToPdfText="Export to Pdf">--%></CommandItemSettings>
            <RowIndicatorColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="ProductDescriptionID" DataType="System.Int64"
                    HeaderText="ID" ReadOnly="True" SortExpression="ProductDescriptionID"
                    UniqueName="ProductDescriptionID" 
                    meta:resourcekey="GridBoundColumnResource1">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ProductBas.Name" HeaderText="Product" SortExpression="ProductBaseID"
                    UniqueName="ProductBaseID" DataType="System.Int64" 
                    meta:resourcekey="GridBoundColumnResource2">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="LanguageCode" HeaderText="LanguageCode" SortExpression="LanguageCode"
                    UniqueName="LanguageCode" meta:resourcekey="GridBoundColumnResource3">
                </telerik:GridBoundColumn>
                <%--Them edit vao bang --FooterText="EditCommand footer"--%>
                <%--Them edit vao bang --FooterText="EditCommand footer"--%>
                <telerik:GridBoundColumn DataField="ShortDescription" HeaderText="ShortDescription"
                    SortExpression="ShortDescription" UniqueName="ShortDescription" 
                    meta:resourcekey="GridBoundColumnResource4">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="FullDescription" HeaderText="FullDescription"
                    SortExpression="FullDescription" UniqueName="FullDescription" 
                    meta:resourcekey="GridBoundColumnResource5">
                </telerik:GridBoundColumn>
                <telerik:GridCheckBoxColumn DataField="IsDefault" DataType="System.Boolean" HeaderText="IsDefault"
                    SortExpression="IsDefault" UniqueName="IsDefault" 
                    meta:resourcekey="GridCheckBoxColumnResource1">
                </telerik:GridCheckBoxColumn>
                <telerik:GridEditCommandColumn ButtonType="ImageButton" 
                    UniqueName="EditCommandColumn" 
                    meta:resourcekey="GridEditCommandColumnResource1">
                    <ItemStyle CssClass="MyImageButton"></ItemStyle>
                </telerik:GridEditCommandColumn>
                <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                    ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                    UniqueName="DeleteColumn" meta:resourcekey="GridButtonColumnResource1">
                    <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton"></ItemStyle>
                </telerik:GridButtonColumn>
            </Columns>
            <EditFormSettings EditFormType="Template">
<EditColumn UniqueName="EditCommandColumn1"></EditColumn>
                <FormTemplate>
                    <table id="Table2" style="border-collapse: collapse; padding-left: 20">
                        <tr class="EditFormHeader" style="height: 30px">
                            <td style="font-size: small" colspan="2">
                               <b><asp:Label ID="Label1" runat="server" Text="Product Description" 
                                    meta:resourcekey="Label1Resource1"></asp:Label> </b>
                            </td>
                        </tr>
                        <tr style="height: 30px">
                            <td>
                                <asp:Label ID="lbProductBaseID" runat="server" Text="Product Base:" 
                                    meta:resourcekey="lbProductBaseIDResource2"></asp:Label>
                            </td>
                            <td style="">
                                <telerik:RadComboBox CssClass="rancombox" runat="server" ID="RadComboBox2" DataTextField="ProductBaseID"
                                    DataValueField="ProductBaseID" DataSourceID="GroupProductEds" SelectedValue='<%# Bind("ProductBaseID") %>'
                                    AutoPostBack="True" EnableLoadOnDemand="True" 
                                    meta:resourcekey="RadComboBox2Resource1">
                                    <HeaderTemplate>
                                        <ul>
                                            <li style="list-style-type: none" class="col1"><asp:Label ID="lbProductBaseID" 
                                                    runat="server" Text="Product Base" meta:resourcekey="lbProductBaseIDResource3"></asp:Label></li>
                                        </ul>
                                    </HeaderTemplate>
                                </telerik:RadComboBox>
                            </td>
                        </tr>
                        <tr style="height: 30px">
                            <td class="titlename">
                                <asp:Label ID="lbLanguageCode" runat="server" Text="LanguageCode:" 
                                    meta:resourcekey="lbLanguageCodeResource1"></asp:Label>
                            </td>
                            <td style="">
                                <telerik:RadComboBox CssClass="rancombox" runat="server" ID="RadComboBox1" DataTextField="Name"
                                    DataValueField="LanguageCode" DataSourceID="GroupLanguageEds" SelectedValue='<%# Bind("LanguageCode") %>'
                                    AutoPostBack="True" EnableLoadOnDemand="True" 
                                    meta:resourcekey="RadComboBox1Resource1">
                                    <HeaderTemplate>
                                        <ul>
                                            <li style="list-style-type: none" class="col1"><asp:Label ID="language12" 
                                                    runat="server" Text="Language Code:" meta:resourcekey="language12Resource1"></asp:Label></li>
                                        </ul>
                                    </HeaderTemplate>
                                </telerik:RadComboBox>
                            </td>
                        </tr>
                        <tr style="height: 30px">
                            <td class="titlename">
                                <asp:Label ID="lbShortDescription" runat="server" Text="ShortDescription:" 
                                    meta:resourcekey="lbShortDescriptionResource1"></asp:Label>
                            </td>
                            <td style="width: 50; height: 30px">
                                <asp:TextBox ID="TextBox6" Text='<%# Bind("ShortDescription") %>' runat="server"
                                    TextMode="MultiLine" Rows="2" Columns="40" TabIndex="6" 
                                    meta:resourcekey="TextBox6Resource1"></asp:TextBox>
                            </td>
                        </tr>
                        <tr style="height: 30px">
                            <td>
                                <asp:Label ID="lbIsDefault" runat="server" Text="IsDefault:" 
                                    meta:resourcekey="lbIsDefaultResource1"></asp:Label>
                            </td>
                            <td style="width: 30">
                                <asp:CheckBox ID="TextBox4" runat="server" Checked='<%# Bind("IsDefault") %>' 
                                    TabIndex="1" meta:resourcekey="TextBox4Resource1">
                                </asp:CheckBox>
                            </td>
                        </tr>
                    </table>
                    <table>
                        <tr style="height: 30px">
                            <td colspan="2">
                                <asp:Label ID="lbFullDescription" runat="server" Text="FullDescription:" 
                                    meta:resourcekey="lbFullDescriptionResource1"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 50px" colspan="2">
                                <telerik:RadEditor runat="server" ID="RadEditor2"
                                    Width="700px" meta:resourcekey="RadEditor2Resource1">
                                    <Content>
</Content>
                                </telerik:RadEditor>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-bottom: 10; padding-top: 10">
                                <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                    runat="server" 
                                    CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' 
                                    meta:resourcekey="btnUpdateResource1">
                                </asp:Button>&nbsp;
                                <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                    CommandName="Cancel" meta:resourcekey="btnCancelResource1"></asp:Button>
                            </td>
                        </tr>
                    </table>
                </FormTemplate>
            </EditFormSettings>
        </MasterTableView>
        <%-- <HeaderContextMenu EnableImageSprites="True" CssClass="GridContextMenu GridContextMenu_Default">
        </HeaderContextMenu>--%>
        <HeaderContextMenu EnableImageSprites="True" CssClass="GridContextMenu GridContextMenu_Office2007">
        </HeaderContextMenu>
    </telerik:RadGrid>
    <asp:EntityDataSource ID="GroupProductDescriptionEds" runat="server" ConnectionString="name=MLMDataContext"
        DefaultContainerName="MLMDataContext" EnableDelete="True" EnableFlattening="False"
        EnableInsert="True" EnableUpdate="True" 
        EntitySetName="ProductDescriptions" Include="ProductBas">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="GroupLanguageEds" runat="server" ConnectionString="name=MLMDataContext"
        DefaultContainerName="MLMDataContext" EnableDelete="True" EnableFlattening="False"
        EnableInsert="True" EnableUpdate="True" EntitySetName="Languages" 
        EntityTypeFilter="Language">
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="GroupProductEds" runat="server" ConnectionString="name=MLMDataContext"
        DefaultContainerName="MLMDataContext" EnableDelete="True" EnableFlattening="False"
        EnableInsert="True" EnableUpdate="True" EntitySetName="ProductBases">
    </asp:EntityDataSource>
</asp:Content>
<%--<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder4" runat="server">
</asp:Content>--%>
